////////////////////////////////////////////////////////////////////////////////
/// HelloWorld.c
/// Example File to turn on all LEDS attached to PORTB
/// Hardware: STK500
/// Connections:
/// Leds connected to PORTB0-7 Active Low
/// 
////////////////////////////////////////////////////////////////////////////////

//Include the Header file for Input/Output Operations
#include <avr/io.h>
#include <avr/delay.h>

#define F_CPU 8000000

//Begin the program
int main(void) { 
	DDRB = 255; //Set PORTB for Output 
	PORTB = 0; //Set all outputs low
	
	_delay_ms(5000);
	
	
	DDRD = 255;
	
	PORTD = 0b00001100; //init
	PORTD |= (1 << 1);
		_delay_ms(100);
	PORTD &= ~(1 << 1);	
	_delay_ms(100);
	
	PORTD = 0b00001100; //init
	PORTD |= (1 << 1);
		_delay_ms(100);
	PORTD &= ~(1 << 1);	
	_delay_ms(100);
	
	PORTD = 0b00001100; //init
	PORTD |= (1 << 1);
		_delay_ms(100);
	PORTD &= ~(1 << 1);	
	_delay_ms(100);
	
	
	
	PORTD = 0b00001000; //Set 4 bit mode
	PORTD |= (1 << 1);
	_delay_ms(100);
	PORTD &= ~(1 << 1);
	_delay_ms(100);
	
	PORTD = 0b00001000; //2 line 5x7
	PORTD |= (1 << 1);
		_delay_ms(100);
	PORTD &= ~(1 << 1);	
	PORTD = 0b00100000;
	PORTD |= (1 << 1);
		_delay_ms(100);
	PORTD &= ~(1 << 1);	
	
		_delay_ms(100);
	PORTD = 0b00000000; //display on underline on blink on
	PORTD |= (1 << 1);
		_delay_ms(100);
	PORTD &= ~(1 << 1);	
	PORTD = 0b00111100;
	PORTD |= (1 << 1);
		_delay_ms(100);
	PORTD &= ~(1 << 1);
	
	
	//odd error location goes to second block, not first. fix me
	
	
	for(;;)
		{;}
		
}
